<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="utf-8"/>
  <title>文本差异对比工具</title>
<!--  <title>Online File Diff and Mergely, Powered By aTool. </title>-->
  <meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
  <link rel="shortcut icon" href="./favicon.ico">
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <meta name="description" content="Merge and Diff your documents with diff online and share"/>
  <meta name="keywords"
        content="diff,merge,compare,jsdiff,comparison,difference,file,text,unix,patch,algorithm,saas,longest common subsequence"/>
  <meta name="author" content="Jamie Peabody"/>
  <!-- Requires jQuery -->
  <script src="./lib/jquery.min.js" type="text/javascript"></script>
  <!-- Requires CodeMirror -->
  <script type="text/javascript" src="./lib/codemirror.js"></script>
  <link type="text/css" rel="stylesheet" href="./lib/codemirror.css"/>
  <!-- Requires Mergely -->
  <script type="text/javascript" src="./lib/mergely.js"></script>
  <link type="text/css" rel="stylesheet" href="./lib/mergely.css"/>
</head>
<body>
<div id="mergely-resizer">
  <div id="compare">
  </div>
</div>
</body>
<script type="text/javascript">
  function getWinHeight() {
    var winHeight = 0;
    if (window.innerHeight)
      winHeight = window.innerHeight;
    else if ((document.body) && (document.body.clientHeight))
      winHeight = document.body.clientHeight;
    return winHeight;
  }

  function getWinWidth() {
    var winWidth = 0;
    if (window.innerWidth)
      winWidth = window.innerWidth;
    else if ((document.body) && (document.body.clientWidth))
      winWidth = document.body.clientWidth;
    return winWidth;
  }

  $(document).ready(function () {
    $('#compare').mergely({
      width: 'auto',
      height: '400',
      cmsettings: {
        readOnly: false,
        lineWrapping: true,
      },
      lhs: function (setValue) {
        setValue('welcome here, I\'m ikun.\n 差异最小单位是一个词 就是必须用空格分开的单词,比如: aaa bb c dd.\n所以中文也是要空格或换行行隔开\n就比如这样 祝你使用愉快。');
      },
      rhs: function (setValue) {
        setValue('welcome here, I\'m not 小黑子.\n 差异最小单位是一个词 就是必须空格分开的单词,比如: aaa bbb c dd.\n所以中文也是要空格或换行行隔开\n就比如这样 祝你用的开心。');
      }
    });
    $(window).resize(function () {
      $('#compare').mergely('options', {height: getWinHeight() - 30, width: getWinWidth() - 30});
      $('#compare').mergely('update')
    });
    $(window).resize();
  });

</script>
</html>
